package org.offsync.apps

class RspHandler {
  private var rsp: Array[Byte] = null
  
  def handleResponse(rsp: Array[Byte]): Boolean = this.synchronized {
    this.rsp = rsp
    this.notify()
    return true
  }
  
  def waitForResponse(): Unit = this.synchronized {
    while(this.rsp == null) {
      try {
        this.wait()
      } catch { case e: InterruptedException =>
      }
    }
    
    System.out.println(new String(this.rsp))
  }
}
